import { login } from '@/api/user';

/* eslint-disable no-unused-expressions */
export default {
  namespaced: true,
  state: { toklen: '' },
  mutations: {
    saveToken(state, token) {
      state.token = token;
      console.log('state.token', state.token);
    },
  },
  actions: {
    async  getToken(context, user) {
      const res = await login(user);
      console.log('res', res);
      context.commit('saveToken', res.token);
    },
  },
};
